package com.hehe.app_test_backend.Service;

import com.hehe.app_test_backend.Mapper.*;
import com.hehe.app_test_backend.Model.*;
import com.hehe.app_test_backend.Util.DateUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class ##ClassServiceName# {
    @Autowired
    private ##DaoClassName# mapper;

    public int add(##ModelClassName# obj) throws Exception {
        obj.setCreateTime(DateUtil.getTimeStamp());
        obj.setUpdateTime(DateUtil.getTimeStamp());
        return mapper.add(obj);
    }

    public int delete(Integer id) throws Exception {
        return mapper.delete(id);
    }

    public int update(##ModelClassName# obj) throws Exception {
        obj.setUpdateTime(DateUtil.getTimeStamp());
        return mapper.update(obj);
    }

    public List<##ModelClassName#> getAll() {
        return mapper.getAll();
    }

    public ##ModelClassName# getSingle(Integer id) {
        return mapper.getSingle(id);
    }
}